//----------------------------------*-C++-*----------------------------------//
/*!
 * \file   testResponseFunction.cc
 * \author Jeremy Roberts
 * \date   11/24/2010
 * \brief  test of ResponseFunction
 * \note   Copyright (C) 2010 Jeremy Roberts
 */
//---------------------------------------------------------------------------//
// $Rev::                                               $:Rev of last commit
// $Author::                                            $:Author of last commit
// $Date:: 2010-11-08 20:29:53 -0500 (Mon, 08 Nov 2010) $:Date of last commit
//---------------------------------------------------------------------------//

#include <iostream>
#include "../ResponseFunction.hh"
#include "../ResponseFunctionDiffusion.hh"
#include "../linalg/typedefs.hh"
using namespace std;
//---------------------------------------------------------------------------//

int main(int argc, char *args[])
{
    // initialize petsc
    PetscInitialize(&argc,&args,PETSC_NULL,PETSC_NULL);
    cout << " -------------------------------------------- " << endl;
    cout << " -- test of ResponseFunction and vector of -- " << endl;
    cout << " -------------------------------------------- " << endl;
	// test of ResponseFunction
    // -- make two sets of each response.

    integer n = 10;
    scalar *C1, *L1, *F1, *A1, *C2, *L2, *F2, *A2;
    C1 = new scalar[n]; C2 = new scalar[n];
    L1 = new scalar[n]; L2 = new scalar[n];
    F1 = new scalar[n]; F2 = new scalar[n];
    A1 = new scalar[n]; A2 = new scalar[n];

    ResponseFunctionDiffusion **RFs;
    RFs = new ResponseFunctionDiffusion*[2];

    for (integer i = 0; i < n; i++)
    {
        C1[i] = 1.0; C2[i] = 2.0;
        L1[i] = 3.0; L2[i] = 4.0;
        F1[i] = 5.0; F2[i] = 6.0;
        A1[i] = 7.0; A2[i] = 8.0;
    }
    
    RFs[0] = new ResponseFunctionDiffusion( C1, L1, F1, A1 );
    RFs[1] = new ResponseFunctionDiffusion( C2, L2, F2, A2 );

    scalar *tmp;

    tmp = RFs[0]->getCurrentResponse();
    for (integer i = 0; i < n; i++)
        cout << " C1[" << i << "] ="<< C1[i] << " tmp=" << tmp[i] << endl;
  

    tmp = RFs[1]->getAbsorptionResponse();
    for (integer i = 0; i < n; i++)
        cout << " A2[" << i << "] ="<< A2[i] << " tmp=" << tmp[i] << endl;

    delete [] RFs;
    delete [] C1; delete [] C2;
    delete [] L1; delete [] L2;
    delete [] F1; delete [] F2;
    delete [] A1; delete [] A2;

	PetscFinalize();

	cout << "  ... all finished. now check for errors! " << endl;

    return 0;
}

//---------------------------------------------------------------------------//
//                 end of testResponseFunction.cc
//---------------------------------------------------------------------------//

